package com.kamistoat.meimeimall.meimeimallware;

import com.kamistoat.meimeimall.meimeimallware.learn.LearnApplicationContextInitializer;
import com.kamistoat.meimeimall.meimeimallware.learn.LearnApplicationListener;
import com.kamistoat.meimeimall.meimeimallware.learn.LearnEventListener;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableRabbit
@EnableFeignClients(basePackages = "com.kamistoat.meimeimall.meimeimallware.feign")
@EnableTransactionManagement
@EnableDiscoveryClient
@MapperScan("com.kamistoat.meimeimall.meimeimallware.dao")
@SpringBootApplication
@EnableDubbo
public class MeimeimallWareApplication {
    /**
     * 默认的入口类写法
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(MeimeimallWareApplication.class, args);
        Logger logger = LoggerFactory.getLogger(MeimeimallWareApplication.class);
        logger.info("(♥◠‿◠)ﾉﾞ  梅梅ware启动成功   ლ(´ڡ`ლ)ﾞ  \n");
        System.out.println(
                "/$$      /$$             /$$     /$$      /$$             /$$   \n" +
                        "| $$$    /$$$            |__/    | $$$    /$$$            |__/  \n" +
                        "| $$$$  /$$$$   /$$$$$$   /$$    | $$$$  /$$$$   /$$$$$$   /$$  \n" +
                        "| $$ $$/$$ $$  /$$__  $$ | $$    | $$ $$/$$ $$  /$$__  $$ | $$  \n" +
                        "| $$  $$$| $$ | $$$$$$$$ | $$    | $$  $$$| $$ | $$$$$$$$ | $$  \n" +
                        "| $$\\  $ | $$ | $$_____/ | $$    | $$\\  $ | $$ | $$_____/ | $$  \n" +
                        "| $$ \\/  | $$ |  $$$$$$$ | $$    | $$ \\/  | $$ |  $$$$$$$ | $$  \n" +
                        "|__/     |__/  \\_______/ |__/    |__/     |__/  \\_______/ |__/ ");
    }

    /**
     * 学习Springboot源码时进行的修改，为了使用上自定义的 ApplicationContextInitializer接口
     * 只是增加了一个打印Bean数量的Initializer，对业务逻辑毫无影响
     * @param args
     */
//    public static void main(String[] args) {
//        SpringApplication application = new SpringApplication(MeimeimallWareApplication.class);
//        application.addInitializers(new LearnApplicationContextInitializer());
//        application.addListeners(new LearnApplicationListener());
//        application.addListeners(new LearnEventListener());
//        application.run(args);
//    }
}
